
public class Demo3 {

	public static void main(String[] args) {
		int[] arr = {11,22,33,44,55};
		arr(arr);
		for (int i = 0; i < arr.length; i++) {
			System.out.println(arr[i]);
		}
	}
	public static void arr(int[] arr) {
		int max = arr[0];
		int min = arr[1];
		for (int i = 0; i < arr.length; i++) {
			if (max<arr[i]) {
				max = arr[i];
				arr[i] = arr[0];
				arr[0] = max;
			}
			if (min>arr[i]) {
				min = arr[i];
				arr[i] = arr[1];
				arr[1] = min;
			}
		
		}
	
	}
}
